import java.time.*;
import java.util.*;
import java.util.stream.Collectors;
import java.io.*;
class FrontDesk extends User {
    public FrontDesk(String userId, String username, String password, String phone) {
        super(userId, username, password, phone, "前台");
    }

    @Override
    public void showMenu(Logger logger, CinemaSystem system) {
        Scanner scanner = new Scanner(System.in);
        while (true) {
            System.out.println("\n===== 前台菜单 =====");
            System.out.println("1. 修改自身密码");
            System.out.println("2. 列出所有影片");
            System.out.println("3. 列出所有场次");
            System.out.println("4. 查看场次座位信息");
            System.out.println("5. 售票");
            System.out.println("6. 退票");
            System.out.println("7. 退出登录");
            System.out.print("请选择操作: ");

            int choice = scanner.nextInt();
            scanner.nextLine();

            switch (choice) {
                case 1:
                    System.out.print("输入新密码: ");
                    String newPassword = scanner.nextLine();
                    this.changePassword(newPassword, logger);
                    break;
                case 2:
                    system.listAllMovies();
                    break;
                case 3:
                    system.listSessions();
                    break;
                case 4:
                    System.out.print("输入场次ID: ");
                    String sessionId = scanner.nextLine();
                    system.viewSessionSeats(sessionId);
                    break;
                case 5:
                    system.sellTicket(logger, this);
                    break;
                case 6:
                    System.out.print("输入要退的票号: ");
                    String ticketId = scanner.nextLine();
                    system.refundTicket(ticketId, logger, this);
                    break;
                case 7:
                    this.logout();
                    return;
                default:
                    System.out.println("选择无效！");
            }
        }
    }
}